Socket
Socket
Sign inDemoInstall

util-extend

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

util-extend

Node's internal object extension function


Version published
Weekly downloads
823K
decreased by-7.72%
Maintainers
1
Weekly downloads
 
Created

What is util-extend?

The util-extend npm package is a utility library that provides functionality to extend objects. It is commonly used to merge properties from one or more source objects into a target object, effectively combining their properties.

What are util-extend's main functionalities?

Basic Object Extension

This feature allows you to extend a target object with properties from a source object. In this example, the target object { a: 1 } is extended with the source object { b: 2 }, resulting in { a: 1, b: 2 }.

const extend = require('util-extend');
const target = { a: 1 };
const source = { b: 2 };
const result = extend(target, source);
console.log(result); // { a: 1, b: 2 }

Multiple Source Objects

This feature allows you to extend a target object with properties from multiple source objects. In this example, the target object { a: 1 } is extended with source objects { b: 2 } and { c: 3 }, resulting in { a: 1, b: 2, c: 3 }.

const extend = require('util-extend');
const target = { a: 1 };
const source1 = { b: 2 };
const source2 = { c: 3 };
const result = extend(target, source1, source2);
console.log(result); // { a: 1, b: 2, c: 3 }

Overwriting Properties

This feature allows you to overwrite properties in the target object with properties from the source object. In this example, the target object { a: 1, b: 2 } is extended with the source object { b: 3, c: 4 }, resulting in { a: 1, b: 3, c: 4 }.

const extend = require('util-extend');
const target = { a: 1, b: 2 };
const source = { b: 3, c: 4 };
const result = extend(target, source);
console.log(result); // { a: 1, b: 3, c: 4 }

Other packages similar to util-extend

FAQs

Package last updated on 10 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc